<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:icecore="http://www.icefaces.org/icefaces/core"
      xmlns:ace="http://www.icefaces.org/icefaces/components"
      xmlns:ice="http://www.icesoft.com/icefaces/component">
    <ui:composition template="/template.xhtml">
        <ui:define name="right">
            <br></br><ui:include src="/front/usuario/login.xhtml" />
            <br></br><ui:include src="/modulos/seleccionarPlantilla.xhtml"/>
            <ui:include src="/front/carrito/linkCarrito.xhtml"/>
        </ui:define>
        <ui:define name="left">
            <ui:include src="/modulos/frontLeft.xhtml" />    
        </ui:define>
        <ui:define name="content">
            <ice:form >
                <ace:dataTable id="carTable" value="#{mbListProd.obtenerProducto()}" var="var"
                               paginator="true" paginatorPosition="bottom" rows="5" >
                    <ace:column>
                        <table width="100%" >
                            <tr>
                                <ice:outputText value="#{var.nombre}"/> 
                                <td align="Center">Precio: 
                                    <ice:outputText value="#{var.precio}">
                                        <f:convertNumber type="currency"
                                         currencySymbol="€"
                                         groupingUsed="true"
                                         minFractionDigits="2"
                                         maxFractionDigits="2"/>
                                    </ice:outputText>
                                </td>
                            </tr>
                            <br></br>
                            <tr><img src="#{var.imagen}" ></img></tr>
                        </table>
                    </ace:column>
                </ace:dataTable>
                <ice:panelGrid columns="2" >
                    <ice:outputLabel value="Indique una cantidad" for="cantidad" styleClass="css_Label" ></ice:outputLabel>
                    <ice:inputText required="true" id="cantidad" value="#{mbListProd.cantidad}" size="6" maxlength="30" />
                    <ice:inputHidden id="id" value="#{mbListProd.prodId}"></ice:inputHidden>
                </ice:panelGrid>
                <ice:commandButton action="#{mbListProd.comprar()}" value="Añadir a carrito"  > 
                </ice:commandButton>
                <br />
            </ice:form>
        </ui:define>
    </ui:composition>
</html>